home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / amos / kyzeramoscode.lha / Rotate.AMOS / Rotate.amosSourceCode
AMOS Source Code  |  1992-09-03  |  1KB  |  48 lines

  1. ' great idea for a intro by Kyzer/CSG 1/96 
  2. ' this is a sort of 'test' version in amos, to get the maths right 
  3. ' sine wave scroller (usual 16 pixel 'use line texture as 1x16 line of 
  4. ' scroll, repeat 320 times, each line at y-coord sin(something)' method) 
  5. ' but this time, rotate the scroll in realtime.
  6. ' would be very fast in asm, 25 or 50 Hz.
  7. '
  8. Screen Open 0,320,256,2,0 : Curs Off : Palette 0,$FFF
  9. Cls 0 : Double Buffer : Autoback 0 : Hide 
  10. CX=Screen Width/2 : CY=Screen Height/2
  11. Dim S(359),C(359)
  12. Degree 
  13. For A=0 To 359
  14.    S(A)=Sin(A)*16384
  15.    C(A)=Cos(A)*16384
  16. Next A
  17. '
  18. Dim XE(359),YE(359)
  19. For A=0 To 359
  20.    S=S((360+45-A) mod 360)/2048 : Rem 8 sin a
  21.    C=C((360+45-A) mod 360)/2048 : Rem 8 cos a
  22.    XE(A)=C-S
  23.    YE(A)=-C-S
  24. Next A
  25. '
  26. A=0
  27. For ROT=0 To 359 Step 4
  28.    Add A,16,0 To 359
  29.    S=S(ROT)
  30.    C=C(ROT)
  31.    XE=XE(ROT)
  32.    YE=YE(ROT)
  33.    B=A
  34.    Wait Vbl 
  35.    Cls 0
  36.    For X=-150 To 150
  37.       Add B,1,0 To 359
  38.       Y=S(B)/256
  39.       XC=(X*C)/16384
  40.       XS=(X*S)/16384
  41.       YC=(Y*C)/16384
  42.       YS=(Y*S)/16384
  43.       X1=CX+XC+YS
  44.       Y1=CY+YC-XS
  45.       Draw X1+XE,Y1-YE To X1-XE,Y1+YE
  46.    Next X
  47.    Screen Swap 
  48. Next